<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.neusoft.com/taglib/cutpage" prefix="page"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script language="javascript" src="${pageContext.request.contextPath}/js/back_test.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/back.css" />
<script type="text/javascript">
function chagngClass(classId){
	
	document.getElementById("itemId").length = 1;
	<c:forEach items="${list}" var="item">
		if (${item.parentId} == classId){
			var option = new Option("${item.itemName}","${item.itemId}");
			document.getElementById("itemId").add(option);
		}
	</c:forEach>
}
</script>
<center>
<h3 style="color: #0066CC">商品信息管理</h3>
<form action="${pageContext.request.contextPath}/GoodsServlet?service=checkByReq" method="post">
	<table style="text-align: center;" width="1050px" border="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#0066cc">
		<tr align="center">
			<td>
				<table>
					<tr align="center">
						<td height="40px;">按商品的品牌查询：
							<select id="classId" name="classId" onchange="chagngClass(this.value);">
								<option value="">
												====请选择类别====
								</option>
								<c:forEach items="${biglist}" var="class">
									<option value="${class.classId}" <c:if test="${classId==class.classId}">selected="selected"</c:if>
									               >${class.className}</option>
								</c:forEach>
							</select>		
						</td>
						<td height="40px;">按选择商品的类别查询：
							<select id="itemId" name="itemId">
								<option value="">
												====请选择类别====
								</option>
								<c:forEach items="${list}" var="item">
									<option value="${item.itemId}" <c:if test="${itemId==item.itemId}">selected="selected"</c:if>
									>${item.itemName}</option>
								</c:forEach>
							</select>
						</td>
					</tr>
					<tr align="center">
						<td>
							按商品模糊名称查询：
							<input type="text" name="goodsName" value="${goodsName}">
						</td>
						<td>
							按商品的价格区间查询：
							<select name="price">
								<option value="">---请选择价格区间---</option>
								<option value="1">499元以下</option>
								<option value="2">500~999</option>
								<option value="3">1000~1999</option>
								<option value="4">2000~2999</option>
								<option value="5">3000~3999</option>
								<option value="6">4000以上</option>
							</select>
						</td>
					</tr>
					<tr >
						<td>排序方式：
							<select name="sort">
								<option value="">---请选择排序方式---</option>
								<option value="1">按商品点击次数升序</option>
								<option value="2">按商品点击次数降序</option>
								<option value="3">按商品热销度升序</option>
								<option value="4">按商品热销度降序</option>
							</select>
						</td>	
						<td align="right">
							<input type="submit" value="查询">
						</td>				
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
<table width="1050px" border="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#0066cc">
	<thead>
		<tr bgcolor="#AEC8E4" height="40px">
			<th width="100px">品牌</th>
			<th width="100px">类别</th>
			<th width="50px">编号</th>
			<th width="100px">名称</th>
			<th width="50px">价格</th>
			<th width="50px">库存量</th>
			<th width="200px">描述</th>
			<th width="100px">图片预览</th>
			<th width="100px">浏览次数</th>
			<th width="50px">状态</th>
			<th width="100px">操作</th>
		</tr>
	</thead>
	<tbody align="center">
		<c:forEach items="${goodslist}" var="goods">
			<tr height="40px;">
				<td>${goods.goodsType_name}</td>
				<td>${goods.smallType_name}</td>
				<td>${goods.goodsId}</td>
				<td>${goods.goodsName}</td>
				<td>${goods.price}</td>
				<td>${goods.num}</td>
				<td>${goods.direction}</td>
				<td>
					<img src="${pageContext.request.contextPath}/images/jiantou.gif" onmousemove="quickalt();" onmouseover="getalt('${pageContext.request.contextPath}/img/${goods.picPath}');" onmouseout="restorealt();" />
				</td>
				<td>${goods.checkNum}</td>
				<td>
					<c:choose>
						<c:when test="${goods.state==1}">上架</c:when>
						<c:when test="${goods.state==2}">下架</c:when>
					</c:choose>
				</td>
				<td>
					<a href="${pageContext.request.contextPath}/GoodsServlet?service=modify&goodsId=${goods.goodsId}">修改</a>
					<a href="${pageContext.request.contextPath}/GoodsServlet?service=deleteGoods&goodsId=${goods.goodsId}">删除</a>
				</td>
			</tr>
		</c:forEach>
	</tbody>
</table>
<div style="display:none;border:1px solid #0066cc;position:absolute;" id="_altlayer">
</div>
<div align="center" style="margin-top: 40px;font-size: 10pt">
	<page:pageDisplay pagenum="${pagenum}" url="${pageContext.request.contextPath}/GoodsServlet?service=checkByReq&classId=${classId}&itemId=${itemId}&goodsName=${goodsName}&price=${price}&sort=${sort}" condName="pagenum" maxindex="${usercount}"/>
	<div align="right" style="font-size: 10pt">
		<span>总共记录数：${usercount}</span>
	</div>
</div>
</center>